package cn.lingyangwl.agile.msg.push.api.constatnts;

import cn.lingyangwl.framework.core.utils.spring.SpringUtils;
import cn.lingyangwl.framework.tool.core.StringUtils;
import cn.lingyangwl.framework.tool.core.exception.BizException;
import cn.lingyangwl.agile.msg.push.api.MsgPushApi;
import cn.lingyangwl.agile.msg.push.api.handler.IMsgPushAsyncHandler;
import cn.lingyangwl.agile.msg.push.api.handler.MsgPushToMqHandler;

/**
 * @author shenguangyang
 */
public class StaticService {

    public static MsgPushApi msgPushApi() {
        return SpringUtils.getBean(MsgPushApi.class);
    }

    public static IMsgPushAsyncHandler msgPushAsyncHandler() {
        if (!SpringUtils.containsBean(StringUtils.uncapitalize(MsgPushToMqHandler.class.getSimpleName()))) {
            throw new BizException("请配置mq并引入相关mq依赖");
        }
        return SpringUtils.getBean(IMsgPushAsyncHandler.class);
    }
}
